package com.banciyuan.bcywebview.base.helper.push.Item;

import android.content.Context;
import android.content.Intent;

import com.banciyuan.bcywebview.base.factory.TimelineFactory;
import com.banciyuan.bcywebview.biz.detail.comment.DetailCommentActivity;
import com.banciyuan.bcywebview.utils.intent.gotoUtil;

import de.greenrobot.daoexample.model.DetailType;

/**
 * Created by squall1989 on 2017/1/5.
 */

public class PushItemTen extends BasePush {

    @Override
    public void goPushActivity(Context mContext) {
        super.goPushActivity(mContext);
        try {
            if (msgs.length == 6 || msgs.length == 5) {
                goDetailCommentActiviy();
            } else {
                goMain();
            }
        } catch (Exception e) {
            goMain();
        }
    }

    private void goDetailCommentActiviy() throws Exception {
        Intent intent = new Intent(mContext, DetailCommentActivity.class);
        DetailType detailType = new DetailType();
        if (msgs[1].equals("0")) {
            detailType.setTimelineType(TimelineFactory.TIMELINE_TYPE_COSER);
            detailType.setCp_id(msgs[4]);
            detailType.setRp_id(msgs[5]);
        } else if (msgs[1].equals("1")) {
            detailType.setTimelineType(TimelineFactory.TIMELINE_TYPE_ILLUST);
            detailType.setDp_id(msgs[4]);
            detailType.setRp_id(msgs[5]);
        } else if (msgs[1].equals("4")) {
            detailType.setTimelineType(TimelineFactory.TIMELINE_TYPE_WRITER);
            detailType.setWp_id(msgs[4]);
            detailType.setRp_id(msgs[5]);
        } else if (msgs[1].equals("3")) {
            detailType.setTimelineType(TimelineFactory.TIMELINE_TYPE_DAILY);
            detailType.setUd_id(msgs[4]);
        } else if (msgs[1].equals("2")) {
            detailType.setTimelineType(TimelineFactory.TIMELINE_TYPE_GROUP);
            detailType.setGid(msgs[4]);
            detailType.setPost_id(msgs[5]);
        }
        intent.putExtra(gotoUtil.INTENT_VALUE_ONE, msgs[2]);
        intent.putExtra(gotoUtil.INTENT_VALUE_TWO, detailType);
        intent.putExtra(gotoUtil.INTENT_VALUE_THREE, true);
        goActivities(intent);
    }
}
